package com.halotis.taskLauncher.engine;

import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;

public class MyPacketListener implements PacketListener {

        public void processPacket(Packet packet) {
        	Message message = (Message) packet;
        	if(message.getBody() != null){
        		System.out.println(message.getBody());
        		String cmd = message.getBody();
        		Command command = new Command(message.getFrom(), cmd);
        		new Thread(command).start();
        	}else {
        		System.out.println("Error: No body in message");
        	}
            
        }
}
